-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
escape domain regexes #141
base: main
Are you sure you want to change the base?
Conversation
r"https?://codeload.github.com/(?P<namespace>.+)/(?P<name>.+)/" | ||
r"(zip|tar.gz|tar.bz2|tgz)/(.*/)*" | ||
r"https?://codeload\.github\.com/(?P<namespace>.+)/(?P<name>.+)/" | ||
r"(zip|tar\.gz|tar\.bz2|tgz)/([^/]*/)*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for this change from (.*/)*
to ([^/]*/)*
can be found here:
https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
r"((?P=name)(-|@)?)?" | ||
r"(?P<version_prefix>v|V?)(?P<version>.+).(zip|tar.gz|tar.bz2|.tgz)" | ||
r"(?P<version_prefix>v|V?)(?P<version>.+)\.(zip|tar\.gz|tar\.bz2|tgz)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also fixes a bug with tgz files, since it would previously match
v1.2.3.tgz
as { version="1.2.", extension=".tgz" }
as opposed to { version="1.2.3", extension="tgz" }
due to the double unescaped .
here.
See for clarification: https://regex101.com/r/luaRIy/1
Thanks! do you mind to resolve the conflicts that emerged since so we can merge? |
@pombredanne I've resolved the merge conflicts |
Fixes #140